When starting a selection outside the image-boundaries, the selection-box is drawn from that location to the image-border. This should not happen, because selecting or zooming into 'nothing' makes no sense.
This is a bug which is present in all versions of ristretto, but only shows since the migration to cairo (0.3.0)
Created attachment 4035 Change paint_selection_box in image_viewer.c to not paint a selection-box when the box_width or height < 0.0 It appears that drawing a selection-box of 0.0 becomes a 1 pixel selection box so I set it to return early rather than draw anything. This fixes the selection box bug with the testing I've done, but please let me know if it breaks anything.
That indeed is a better solution then setting the width to 0. I've committed the patch and added some additional comments.